
    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Hash 对象底层结构 - 学习卡片</title>
      <style>
        body { font-family: sans-serif; background-color: #f0f8ff; color: #333; display: flex; flex-direction: column; align-items: center; padding: 50px 20px; }
        .header h1 { font-size: 32px; }
        .grid-container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; width: 100%; max-width: 1200px; }
        .card-container { perspective: 1200px; cursor: pointer; height: 250px; }
        .card { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.7s; border-radius: 16px; box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
        .card-container.flipped .card { transform: rotateY(180deg); }
        .card-face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; display: flex; flex-direction: column; box-sizing: border-box; border-radius: 16px; background-color: #fff; padding: 24px; }
        .card-back { background-color: #f0fff4; transform: rotateY(180deg); justify-content: space-between; }
        .card-category { font-size: 14px; color: #0052d9; margin-bottom: 8px; font-weight: 500; }
        .card-question { font-size: 20px; font-weight: 500; flex-grow: 1; display: flex; align-items: center; justify-content: center; text-align: center; }
        .card-answer-wrapper { flex-grow: 1; overflow-y: auto; }
        .card-answer { font-size: 15px; line-height: 1.7; }
        .card-footer { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 16px; margin-top: 16px; }
        .card-source { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 12px; margin-top: 12px; }
      </style>
    </head>
    <body>
      <div class="header">
        <h1>Hash 对象底层结构 - 学习卡片</h1>
      </div>
      <div class="grid-container">
        
    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">理论</div>
          <div class="card-question">在哈希表中，哈希函数（Hash Function）的核心作用是什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">理论</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">哈希函数的核心作用是将键（key）映射到哈希表中的一个位置（索引），这决定了数据的存储位置。一个好的哈希函数应尽可能均匀地分布键，以减少冲突。</div>
          </div>
          <div class="card-source">来源: 1.1 哈希函数（Hash Function）</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">当多个键映射到同一个哈希桶时，会产生哈希冲突。文档中提到了哪两种主要的冲突解决策略？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">文档中提到的两种主要冲突解决策略是：链表法（Separate Chaining）和开放地址法（Open Addressing）。</div>
          </div>
          <div class="card-source">来源: 1.3 冲突解决策略</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">在线性探测（Linear Probing）这种开放地址法策略中，可能出现什么主要问题？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">线性探测可能导致“聚集”（Clustering）问题，即发生冲突后按固定步长探测，容易使得相邻位置的冲突概率增高，形成连续的占用区域。</div>
          </div>
          <div class="card-source">来源: 3.1 线性探测（Linear Probing）</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">理论</div>
          <div class="card-question">什么是哈希表的负载因子（Load Factor），它对性能有何影响？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">理论</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">负载因子是哈希表中元素的数量与桶的数量之比。它会影响哈希表的性能，因为较高的负载因子可能导致更多的冲突，从而降低操作效率。</div>
          </div>
          <div class="card-source">来源: 4.3 负载因子（Load Factor）</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">当哈希表的负载因子超过预设阈值时，会触发什么操作？该操作包含哪些关键步骤？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">当负载因子超过阈值时，会触发扩容（Resizing）操作。该过程包括两个关键步骤：首先扩展哈希表的大小，然后对所有键值对进行再哈希（Rehashing），即重新计算每个键的哈希值并将其分配到新桶中。</div>
          </div>
          <div class="card-source">来源: 5. 扩容与再哈希</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">根据文档，Java的HashMap和Python的dict在解决哈希冲突的实现上有何不同？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">Java的HashMap使用链表法（Separate Chaining）来解决冲突，并且在Java 8之后引入了红黑树来优化过长的链表。而Python的dict则采用开放地址法（Open Addressing）中的线性探测策略。</div>
          </div>
          <div class="card-source">来源: 6. 应用实例</div>
        </div>
      </div>
    </div>

      </div>
    </body>
    </html>
